import Vue from 'vue';
import VueRouter from 'vue-router';
// import { getToken } from "@/utils/auth.js"

Vue.use(VueRouter)
import routes from "./routes"
let router = new VueRouter({
  routes
});
// 路由守卫
/* router.beforeEach((to, from, next) => {
  console.log(from);
  if (to.path == "/admin/login" || to.path == "/admin/register") {
   return next();
  }

  const token = getToken();

  if (!token && to.path !== "/admin/login") {
    return next("/admin/login")
  } else {
    next()
  }

}) */

export default router
